const express = require('express');
const router = express.Router();

router.get('/forCurrentUser', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: 'string',
        brandCode: 'string',
        brandName: 'string',
        dealerCode: 'string',
        dealerName: 'string',
        status: 1,
        productCategoryCode: 'string',
        productCategoryName: 'string',
        faultPartCode: 'string',
        problemSeverity: 1,
        creatorTime: '2019-09-19T02:14:30.723Z',
        submitTime: '2019-09-19T02:14:30.723Z',
        rowVersion: 'string',
        options: [
            'update',
            'approve',
            'submit',
            'improveResult',
            'abandon',
            'export'
        ]
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 40,
        }
    });
});
router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                id: '1',
                code: 'string',
                branchCode: 'string',
                branchName: 'string',
                brandId: 'string',
                brandCode: 'string',
                brandName: 'string',
                dealerId: 'string',
                dealerCode: 'string',
                dealerName: 'string',
                serviceEngineer: 'string',
                qualityEngineer: 'string',
                status: 1,
                productCategoryCode: 'string',
                productCategoryName: 'string',
                vehicleNature: 1,
                frequency: 1,
                region: 'string',
                country: 'string',
                faultPartCode: 'string',
                customerComplainQty: 1,
                outRescueQty: 1,
                specialCompensateQty: 1,
                carReturnQty: 1,
                marketValueFactor: 1,
                warranty: 1,
                importInfo: 1,
                causePartCode: 'string',
                causePartName: 'string',
                faultyPartBatch: 'string',
                softwareVersionNumber: 'string',
                failureRatio: 1,
                iPTV: 1,
                occurCondition: 1,
                issueRoadConditions: 'string',
                issueWorkConditions: 'string',
                driveHabits: 'string',
                useEnvironment: 'string',
                problemDescribe: 'string',
                servicePropose: 'string',
                factoryAdvice: 'string',
                problemSeverity: 1,
                replyForm: 1,
                creatorTime: '2019-09-19T05:59:35.321Z',
                creatorName: 'string',
                modifierName: 'string',
                modifyTime: '2019-09-19T05:59:35.321Z',
                submitterName: 'string',
                submitTime: '2019-09-19T05:59:35.321Z',
                abandonerName: 'string',
                abandonTime: '2019-09-19T05:59:35.321Z',
                rowVersion: 'string',
                options: [
                    'update',
                    'approve',
                    'submit',
                    'improveResult',
                    'abandon',
                    'export'
                ],
                details: [
                    {
                        id: '1',
                        vin: 'string',
                        productCategoryCode: 'string',
                        productCategoryName: 'string',
                        engineCode: 'string',
                        transmissionSn: 'string',
                        productionDate: '2019-09-19T06:03:31.489Z',
                        saleDate: '2019-09-19T06:03:31.489Z',
                        faultDescription: 'string',
                        inspectionProcess: 'string',
                        dealResult: 'string',
                        partCode: 'string',
                        partName: 'string',
                        supplierCode: 'string',
                        repairDate: '2019-09-19T06:03:31.489Z',
                        mileage: 1,
                        claimPrice: 1,
                        subDealerCode: 'string',
                        subDealerName: 'string'
                    }
                ],
                confirmResult: [
                    {
                        id: 'string',
                        confirmorName: 'string',
                        confirmTime: '2019-09-19T06:03:31.489Z',
                        confirmComment: 'string',
                        approveResult: 1
                    }
                ],
                improveResult: [
                    {
                        id: 'string',
                        registerName: 'string',
                        registerTime: '2019-09-19T06:03:31.489Z',
                        improveSuggestion: 'string'
                    }
                ],
            }
        }
    );
});

router.put('/:id', (req, res) => {
    res.json({
        message: '编辑成功'
    });
});
router.post('/', (req, res) => {
    res.json({
        message: '新增成功'
    });
});
router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});
router.put('/:id/approvePass', (req, res) => {
    res.json({
        message: '审核通过'
    });
});
router.put('/:id/approveBack', (req, res) => {
    res.json({
        message: '审核驳回'
    });
});
router.put('/:id/approveReject', (req, res) => {
    res.json({
        message: '审核拒绝'
    });
});
router.put('/:id/improveResult', (req, res) => {
    res.json({
        message: '改进登记成功'
    });
});
router.get('/:id/export', (req, res) => {
    res.json({
        message: '导出成功'
    });
});
module.exports = router;
